fix(model_runner): map Vertex AI headers via http_options and enable vertexai SDK extra#74
Open
MasakiMu319 wants to merge 2 commits intobubbuild:mainfrom
Open
fix(model_runner): map Vertex AI headers via http_options and enable vertexai SDK extra#74MasakiMu319 wants to merge 2 commits intobubbuild:mainfrom
MasakiMu319 wants to merge 2 commits intobubbuild:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a provider-specific request mapping issue for Vertex AI and adds the required Vertex AI SDK
extra in dependencies.
When using
vertexai:*models, Bub previously passedextra_headersinto the LLM call. In the Vertex AIpath, that value is validated against
GenerateContentConfig, whereextra_headersis invalid, causingruntime errors.
What Changed
ModelRunnerrequest construction:vertexai:*models, pass headers viahttp_options={"headers": ...}.extra_headers.tests/test_model_runner.py:extra_headers.http_options.headersand does not sendextra_headers.extra_headers.any-llm-sdk[anthropic]->any-llm-sdk[anthropic,vertexai]Why
This PR fixes a provider-parameter mismatch that is reproducible with Vertex AI:
BUB_MODEL=vertexai:gemini-3.1-pro-previewuv run buband send a simple messageextra_headersin the model callGenerateContentConfig, whereextra_headersis invalidGenerateContentConfig ... extra_headers ... Extra inputs are not permittedThe fix maps headers correctly for Vertex AI (
http_options.headers) while keeping defaultextra_headersbehavior for non-Vertex providers.
Validation
uv run pytest -q tests/test_model_runner.py(11 passed)uv run ruff check src/bub/core/model_runner.py tests/test_model_runner.py(passed)Fixes Vertex AI runtime failure (
extra_headersvalidation error).Preserves existing behavior for non-Vertex providers.
No public API changes.